<style>
.pure_form_extra { background: #fff; padding: 10px; border: 1px solid #aaa; border-radius: 8px; padding: 10px 20px; }
.pure_form_extra span { font-size: 12px !important; color: #666; font-family: Trebuchet MS; }
.pure_form_extra a { font-size: 13px !important; color: #666; font-family: Trebuchet MS; }
</style>

<?php
$cat = Utils::get_param('cat', NULL);
$id = Utils::get_param('id', NULL);

$opts = new stdClass();
$opts->cd = 't.id = :v1';
$opts->cdv = array(':v1' => $id);
$data = $orm->get('pb_ecom_article', NULL, NULL, NULL, NULL, $opts)->d;

if (count($data) > 0) {
  $data[0]->visited__ += 1;
  $orm->update('pb_ecom_article', $data[0]);
}
?>

<table cellpadding=0 cellspacing=0>
  <tr>
    <td style="width: 730px; vertical-align: top; padding-right: 10px;">
      <div class="pure-form pure_form_extra" style="margin-bottom: 10px;">
        <a>您的位置</a>
        <i class="fa fa-arrow-right"></i>
        <a href="#" onclick="return Url.redirect(__redmd, __sys + '.php?i=' + __id + '&cat=<?php echo $cat; ?>');"><?php echo $cat; ?></a>
        <i class="fa fa-arrow-right"></i>
        <a><?php echo $data[0]->title; ?></a>
      </div>
      <div class="pure-form pure_form_extra" style="min-height: 550px;">
        <legend><?php echo $data[0]->title; ?>&nbsp;<span><?php echo $data[0]->date; ?></span></legend>
        <div style="text-align: justify;"><?php echo $data[0]->content; ?></div>
      </div>
    </td>
    <td style="width: 230px; vertical-align: top;"><?php include PLGN_DIR . basename(dirname(__FILE__)) . '/inc.rightbar.php'; ?></td>
  </tr>
</table>
<div>&nbsp;</div>

<script type="text/javascript">
  var __cat = '<?php echo $cat; ?>';
  var __data = JSON.parse('<?php echo addslashes(json_encode($data)); ?>');
  var __redmd = '<?php echo addslashes($app_data->sys->redmd); ?>';
  var __sys = '<?php echo addslashes($app_data->sys->php_name); ?>';
  var __id = '<?php echo $app_data->param_id; ?>';
  
  $(function(){
    __browsed = Cookie.get_cookie('a_browsed');
    if (!__browsed) {
      __browsed = [{
        id: __data[0].id,
        title: __data[0].title,
        date: __data[0].date,
        __cat: __cat
      }];
    } else {
      __browsed = JSON.parse(__browsed);
      Utils.splice_by_id(__data[0].id, __browsed);
      __browsed.splice(0, 0, {
        id: __data[0].id,
        title: __data[0].title,
        date: __data[0].date,
        __cat: __cat
      });
      if (__browsed.length > 10) {
        __browsed.splice(9, __browsed.length - 10);
      }
    }
    Cookie.set_cookie('a_browsed', JSON.stringify(__browsed), 1);
    
  });
</script>